import requests
import app


class EmployeeApi:

    def __init__(self):
        self.url_add_employee = app.BASE_URL + "/api/sys/user"
        self.url_update_employee = app.BASE_URL + "/api/sys/user/{}"

    def employee_add(self, add_data):
        return requests.post(url=self.url_add_employee, json=add_data, headers=app.headers_data)

    def employee_update(self, employee_id, add_data):
        url = self.url_update_employee.format(employee_id)
        print(url)
        return requests.put(url=url, json=add_data, headers=app.headers_data)

    def employee_get(self, employee_id):
        url = self.url_update_employee.format(employee_id)
        # print(url)
        return requests.get(url=url, headers=app.headers_data)

    def employee_delete(self, employee_id):
        url = self.url_update_employee.format(employee_id)
        return requests.delete(url=url, headers=app.headers_data)
